Skip to content

Conversation

silverwind
Copy link
Member

This adds editorconfig-checker [1] to lint the template files so they conform the editorconfig files. I fixed all current identation issues using the fix mode of eclint [2] and some manual corrections.

We can extend this linting to other files later, for now I'd like this PR to focus on HTML template files only.

[1] https://github.com/editorconfig-checker/editorconfig-checker
[2] https://github.com/jedmao/eclint

@silverwind silverwind added type/refactoring Existing code has been cleaned up. There should be no new functionality. skip-changelog This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features. labels Apr 5, 2021
@silverwind silverwind added this to the 1.15.0 milestone Apr 5, 2021
@silverwind silverwind force-pushed the ec branch 2 times, most recently from f6850d6 to f4865a7 Compare April 5, 2021 11:01
@silverwind
Copy link
Member Author

Note, the checker module is actually https://github.com/editorconfig-checker/editorconfig-checker.javascript which is a JS wrapper around the golang tool, for ease of installation using npm.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Apr 5, 2021
This adds editorconfig-checker [1] to lint the template files so they
conform the editorconfig files. I fixed all current identation issues
using the fix mode of eclint [2] and some manual corrections.

We can extend this linting to other files later, for now I'd like this
PR to focus on HTML template files only.

[1] https://github.com/editorconfig-checker/editorconfig-checker
[2] https://github.com/jedmao/eclint
@silverwind
Copy link
Member Author

silverwind commented Apr 10, 2021

Rebased

Diff is best viewed with whitespace disabled: https://github.com/go-gitea/gitea/pull/15289/files?diff=unified&w=1

Copy link
Member

@6543 6543 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to have this for sooo long :D - thanks

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Apr 10, 2021
@6543
Copy link
Member

6543 commented Apr 10, 2021

@silverwind one thing missing:

templates/repo/issue/milestones.tmpl:
        17: Wrong indentation type(spaces instead of tabs)

@silverwind
Copy link
Member Author

And it swiftly caught a rebase error of mine, fixed.

https://drone.gitea.io/go-gitea/gitea/38396/1/3

@6543
Copy link
Member

6543 commented Apr 10, 2021

this hopefully let us prevent issues like: #14719, ...

@silverwind
Copy link
Member Author

It does only lint the intendation, imbalanced tags are still possible and I'm looking for a linter that can detect these. Maybe https://github.com/ember-template-lint/ember-template-lint.

@6543
Copy link
Member

6543 commented Apr 10, 2021

@silverwind what command did you use for auto-fix the templates, I'll need this to resolve conflicts in other pulls :)

@silverwind
Copy link
Member Author

silverwind commented Apr 10, 2021

npm i -g eclint
eclint fix <file>

Be aware it does not fix all cases. Also see https://github.com/jedmao/eclint#cli

@silverwind silverwind changed the title Enforce tab indendation in templates Enforce tab indentation in templates Apr 10, 2021
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Apr 10, 2021
@techknowlogick techknowlogick merged commit d848098 into go-gitea:master Apr 11, 2021
@silverwind silverwind deleted the ec branch April 12, 2021 11:34
@go-gitea go-gitea locked and limited conversation to collaborators May 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. skip-changelog This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features. type/refactoring Existing code has been cleaned up. There should be no new functionality.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants